#ifndef MAINSCENEWIDGET_H
#define MAINSCENEWIDGET_H
#include <QD3D/QD3DWidget.h>
#include <SensorUtility/Sensor.h>
#include <Reconstruct3D/ReconstructProcess.h>
#include <Reconstruct3D/VisualizeProcess.h>
#include "CameraInterface.h"


class MainSceneWidget : public QD3DWidget
{
	Q_OBJECT

public:
	MainSceneWidget (QWidget *parent = NULL);
	virtual ~MainSceneWidget ();

	void initialize (const QVector< Sensor* >& i_sensorPtrs);
	void initialize (const QString& filePath);

protected:
	virtual void initializeD3D ();

	virtual void paintD3D ();

	virtual void resizeD3D (int width, int height);

	virtual void cleanD3D ();

	void mousePressEvent (QMouseEvent * e);

	void mouseMoveEvent (QMouseEvent * e);

	void mouseReleaseEvent (QMouseEvent * e);

	void wheelEvent (QWheelEvent * e);

	void keyPressEvent (QKeyEvent * e);

	void keyReleaseEvent (QKeyEvent * e);

private:
	ReconstructProcess _reconstructProcess;
	VisualizeProcess _visualizeProcess;
	QVector< Sensor* > _sensorPtrs;
	QVector< bool > _renderFlags;
	Camera _camera;
	CameraInterface _cameraInterface;
	ID3D11BlendState *_pBlendState;
	ID3D11Buffer *_p_verticesForVisualDxBuf;
	ID3D11Buffer* pVerticesToCPUDxBuf;
	std::ofstream _verticesWriter;
	std::ifstream _verticesReader;
	bool _isPause;
	bool _isFromFile;
	float _scale;

	static const ReconstructConfig _CONFIG;

// 	struct LightConstVars
// 	{
// 		glm::vec4 direction;
// 		glm::vec4 color;
// 	} _lightConstVars;

// 	ID3D11Buffer *_p_lightDxConstBuf;
};

#endif // MAINSCENEWIDGET_H
